// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

#nullable disable

using System;
using System.ComponentModel;

namespace Azure.ResourceManager.MySql.Models
{
    /// <summary> Enable Geo-redundant or not for server backup. </summary>
    public readonly partial struct MySqlGeoRedundantBackup : IEquatable<MySqlGeoRedundantBackup>
    {
        private readonly string _value;

        /// <summary> Initializes a new instance of <see cref="MySqlGeoRedundantBackup"/>. </summary>
        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
        public MySqlGeoRedundantBackup(string value)
        {
            _value = value ?? throw new ArgumentNullException(nameof(value));
        }

        private const string EnabledValue = "Enabled";
        private const string DisabledValue = "Disabled";

        /// <summary> Enabled. </summary>
        public static MySqlGeoRedundantBackup Enabled { get; } = new MySqlGeoRedundantBackup(EnabledValue);
        /// <summary> Disabled. </summary>
        public static MySqlGeoRedundantBackup Disabled { get; } = new MySqlGeoRedundantBackup(DisabledValue);
        /// <summary> Determines if two <see cref="MySqlGeoRedundantBackup"/> values are the same. </summary>
        public static bool operator ==(MySqlGeoRedundantBackup left, MySqlGeoRedundantBackup right) => left.Equals(right);
        /// <summary> Determines if two <see cref="MySqlGeoRedundantBackup"/> values are not the same. </summary>
        public static bool operator !=(MySqlGeoRedundantBackup left, MySqlGeoRedundantBackup right) => !left.Equals(right);
        /// <summary> Converts a <see cref="string"/> to a <see cref="MySqlGeoRedundantBackup"/>. </summary>
        public static implicit operator MySqlGeoRedundantBackup(string value) => new MySqlGeoRedundantBackup(value);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => obj is MySqlGeoRedundantBackup other && Equals(other);
        /// <inheritdoc />
        public bool Equals(MySqlGeoRedundantBackup other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0;
        /// <inheritdoc />
        public override string ToString() => _value;
    }
}